package com.geek.service.impl;

import com.geek.mapper.MarketSystemMapper;
import com.geek.model.MarketSystem;
import com.geek.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Service
public class SystemServiceImpl implements SystemService {
    @Autowired
    MarketSystemMapper mapper;

    @Override
    public Map<String, String> toMap() {
        List<MarketSystem> marketSystems = mapper.selectByExample(null);
        Map<String, String> map = marketSystems.stream().collect(Collectors.toMap(MarketSystem::getKeyName, MarketSystem::getKeyValue));
        return map;
    }
}
